#pragma once
#include "DXAMLCommon.h"

#include "CXcpObjectBase.h"
#include "CXcpObjectThreadSafeAddRefPolicy.h"
#include "INotifyOnDeleteCallback.h"


class CValueStore;
class ImageHardwareResources;


class SurfaceCache :
	public CXcpObjectBase<INotifyOnDeleteCallback,CXcpObjectThreadSafeAddRefPolicy>
{
public: 
	static HRESULT Create(SurfaceCache * * ppCache);
	HRESULT AddResources(CXString * pKey, ImageHardwareResources * pResources);
	HRESULT GetResources(CXString * pKey, ImageHardwareResources * * ppResources);
	HRESULT Remove(CXString * pKey);
	HRESULT Clear();
	static void CleanupSurfaceCacheStoreValue(CXString * pKey, void * value, void * extraData);

protected: 
	SurfaceCache();
	virtual ~SurfaceCache();
	HRESULT Initialize();
	virtual void OnDelete(void * token);
	CValueStore * m_pStore;
};
